/*
 * Copyright 2010, 2011 Matt Oliveri
 *
 * This file is part of JConfigGen
 *
 * JConfigGen is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * JConfigGen is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with JConfigGen.  If not, see <http://www.gnu.org/licenses/>.
 */

package atma.jconfiggen.sax;

import java.util.ArrayList;

import org.xml.sax.Attributes;
import org.xml.sax.SAXException;

import atma.jconfiggen.Expr;
import atma.jconfiggen.Call;

class CallObjH extends SpecialFirstH
{
	private final ArrayList<Expr> pnt;
	private final int line;
	private final String type;
	private final String id;
	private final String method;

	CallObjH(SAXHandler s,ArrayList<Expr> p,int ln,String t,String i,String m)
	{
		super(s,new ArrayList<Expr>(10));
		pnt = p;
		line = ln;
		type = t;
		id = i;
		method = m;
	}

	void takeFirst() {pnt.add(new Call(saxh.config,line,type,id,sub.remove(0),method,sub));}

	void end() throws SAXException
	{
		switch (st)
		{
		case 0: complain("Need an object subexpression"); break;
		case 1: pnt.add(new Call(saxh.config,line,type,id,sub.get(0),method,""));
		}
	}
}
